using System;
using System.Collections.Generic;
using System.Text;

namespace UTorrentLib
{

    public enum SizeMods
    {
        b,
        Kb,
        Mb,
        Gb,
        Tb
    }
    static class DisplayFunctions
    {
        static public String FormatSize(long size)
        {
            String output = String.Empty;

            int count = 0;
            float nSize = (float)size;
            while (nSize > 1024)
            {
                nSize = nSize / 1024;
                count++;
            }
            Decimal res = (decimal)nSize;
            res = Math.Truncate(res * 10) / 10;

            output = res.ToString() + (SizeMods)count;
            return output;
        }
    }
}
